package indi.zhs.dhcp;

import java.util.Properties;
import java.util.logging.Level;  
import java.util.logging.Logger;  

import org.dhcp4java.DHCPCoreServer;
import org.dhcp4java.DHCPServerInitException;

public class TESTDhcp {
	private static final Logger logger = Logger  
            .getLogger("org.dhcp4java.examplesserver.dhcpstaticserver"); 
	/** 
     * Server launcher. 
     *  
     * @param args 
     *            command line arguments - ignored 
     */  
    public static void main(String[] args) {  
    	logger.info("Server Start");
        try {  
            DHCPCoreServer server = DHCPCoreServer.initServer(  
                    new DHCPManager(), getProperties());  
            logger.setLevel(Level.ALL);  
            new Thread(server).start();  
            
        } catch (DHCPServerInitException e) {  
            logger.log(Level.SEVERE, "Server init", e);  
        }  
    }  
    
    public static Properties getProperties(){
    	Properties properties = new Properties();
    	//这个配置文件Key是MAC地址，格式是client.mac
    	//分配的网关掩码和DNS都在DHCPManager里，一个DEMO而已，大伙可以将这些都扩展为配置项或者自己弄一个地址池。
    	properties.put("client.005056b29708", "192.168.1.2");
		return properties;
    }

}
